package com.wn.consumer.demo03;

import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.core.ExchangeTypes;
import org.springframework.amqp.rabbit.annotation.Exchange;
import org.springframework.amqp.rabbit.annotation.Queue;
import org.springframework.amqp.rabbit.annotation.QueueBinding;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

/**
 * @author yellow Docter
 * @date 2022 -11-02
 * @desc  log 消费者
 *
 */
@Component
@Slf4j
public class LogConsumer {

    @RabbitListener(
            bindings = @QueueBinding(
                    value = @Queue(name = "queue-direct-log"),
                    exchange = @Exchange(
                            name = "direct-log",
                            type = ExchangeTypes.DIRECT
                    ),
                    key = {"info","error","warning"}
            )
    )
    public void handlerMsg(String msg){

        log.info("log消费者消费:{}",msg);

    }

}
